package com.lambda.optional.ex01;

import com.neibu.hw4.Student;

import java.util.Optional;

/**
 * @author bin
 * @date 2025 - 04 -07
 **/
public class Main02 {
    public static void main(String[] args) {
        Student stu = new Student(null, 18);
        Optional<Student> optional = Optional.of(stu);
        String username = optional.map((stu2) -> {
            String name = stu2.getName();
            return name != null ? name.toLowerCase() : null;
        }).orElse("匿名");

        System.out.println(username);
    }
}
